package com.example.user.constants;

import com.example.framework.common.exception.ServiceException;
import com.example.framework.common.exception.enums.GlobalErrorCodeConstants;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum SourceTypeEnum {

    SMS(1),
    EMAIL(2),
    NAME(3);

    private final int type;

    public static SourceTypeEnum get(int type) {
        SourceTypeEnum[] sourceTypeEnums = SourceTypeEnum.values();
        for (SourceTypeEnum sourceTypeEnum : sourceTypeEnums) {
            if (sourceTypeEnum.type == type) {
                return sourceTypeEnum;
            }
        }
        throw ServiceException.of(GlobalErrorCodeConstants.NOT_IMPLEMENTED);
    }
}
